package Modules::Utilities;

sub new {
  my ($class) = @_;
  my $self = {
               'CONFIG_FILE_PATH' => '',
               'TIME_START'       => time,
               'GFF_FIELDS'       => ['seq_id','source','primary_tag','CDS_start','CDS_end','score','strand','frame'],
             };
  bless $self,$class;
  return $self;
}

sub time_elapsed {
  my $self = shift;
  return time - $self->{TIME_START};
}

sub read_conf_file {
  my ($self,$conf,$conf_file_type) = @_;
  $self->{'CONFIG_FILE_PATH'}      = $conf;
  open (CONFIG,"<$conf") or die "cannot find configuration file: $!";
  while (<CONFIG>) {
    chomp;                  # no newline
    s/#.*//;                # no comments
    s/^\s+//;               # no leading white
    s/\s+$//;               # no trailing white
    next unless length;     # anything left?
    my ($param, $value) = split(/\s*=\s*/, $_, 2);
    
    $value = '' if !defined $value;
    $self->{$param} = $value;
  } 
  close(CONFIG);
  return ;
}




1;